package com.feixiang.feixiangpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.feixiang.feixiangpicturebackend.model.dto.space.SpaceAddRequest;
import com.feixiang.feixiangpicturebackend.model.dto.space.SpaceQueryRequest;
import com.feixiang.feixiangpicturebackend.model.entity.Space;
import com.baomidou.mybatisplus.extension.service.IService;
import com.feixiang.feixiangpicturebackend.model.entity.User;
import com.feixiang.feixiangpicturebackend.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author 20144
 * @description 针对表【space(空间)】的数据库操作Service
 * @createDate 2025-07-12 15:54:29
 */
public interface SpaceService extends IService<Space> {
    /**
     * 创建空间
     * @param spaceAddRequest 空间添加请求
     * @param loginUser 当前登录用户
     * @return 创建的空间ID
     */
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 构造查询条件
     *
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     * 获取单个空间封装
     *
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 分页获取空间封装
     *
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

    /**
     * 空间校验
     *
     * @param space
     */
    void validSpace(Space space, boolean add);

    /**
     * 空间填充，根据空间的等级分配容量
     */
    public void fillSpaceBySpaceLevel(Space space);

    /**
     * 检查空间权限
     */
    void checkSpaceAuth( User loginUser,Space space);

}
